from django.http import JsonResponse
from .res_code import Code

def json_response(errno=Code.OK,errmsg='',data=None,kwargs=None):
    json_dict={
        "errno":errno,
        "errmsg":errmsg,
        "data":data
    }
    if kwargs and isinstance(kwargs,dict):
        json_dict.update(kwargs)
    print(JsonResponse(json_dict))
    return JsonResponse(json_dict)